<%@page language="java"%>
<%@page import="java.sql.*"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Edit Customer Data</title>

<script language="javascript" type="text/javascript">

function Button1_onclick() {
if(document.myForm.UserName.value == "")
		alert("You must put a username!")
  else{document.myForm.submit()}
}

function Button2_onclick() {
    window.open("index.htm","_self");
}

</script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery_tabs.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function() {$('#tabs_news').tabs({ fxFade: true, fxSpeed: 'fast' });});
</script>
</head>
<body>
<div class="main">
  <div class="header">
    <div class="resize">
      <div class="logo"><a href="index.htm"><img src="images/logo.png" width="171" height="42" border="0" /></a></div>
      <div class="clr"></div>
    </div>
    <div class="clr"></div>
  </div>
  <div class="slider_resize">
    <div class="clr"></div>
  </div>
  <div class="FBG">
    <div class="clr"></div>
  </div>
  <div class="body">
    <div class="resize">
      <div class="left">
      
      
        <h2>Edit Customer Data</h2>
        <form name="myForm" action="update.jsp" method="post">
        	<input type="hidden" name="target" value="customer">
        <table width="400" border="0">

<%
String PersonId=request.getParameter("id");
int num=Integer.parseInt(PersonId);

int sumcount=0;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/snazzy_bids", "root", "");
String query = "select * from Customer_ALL_DATA where PersonId='"+PersonId+"'";
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
while(rs.next()){
%>
          <tr>
            <td width="100">User Name:</td>
            <td width="290"><input type="text" name="UserName" value="<%=rs.getString("UserName")%>"></td>
          </tr>
          <tr>
            <td>First Name:</td>
            <td><input type="text" name="FirstName" value="<%=rs.getString("FirstName")%>"></td>
          </tr>
          <tr>
            <td>Last Name:</td>
            <td><input type="text" name="LastName" value="<%=rs.getString("LastName")%>"></td>
          </tr>
          <tr>
            <td>Address:</td>
            <td><input type="text" name="Address" value="<%=rs.getString("Address")%>"></td>
          </tr>
          <tr>
            <td>City:</td>
            <td><input type="text" name="City" value="<%=rs.getString("City")%>"></td>
          </tr>
          <tr>
            <td>State:</td>
            <td><input type="State" name="UserName" value="<%=rs.getString("State")%>"></td>
          </tr>
          <tr>
            <td>Zipcode:</td>
            <td><input type="text" name="ZipCode" value="<%=rs.getString("ZipCode")%>"></td>
          </tr>
          <tr>
            <td>Email:</td>
            <td><input type="text" name="Email" value="<%=rs.getString("Email")%>"></td>
          </tr>
          <tr>
            <td>Credit Card:</td>
            <td><input type="text" name="CreditCard" value="<%=rs.getString("CreditCard")%>"></td>
          </tr>
          <tr>
            <td>Phone #:</td>
            <td><input type="text" name="Phone" value="<%=rs.getString("Phone")%>"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Update" style="background-color:#49743D;font-weight:bold;color:#ffffff;"></td>
</tr>
<%
	}
	}
	catch(Exception e){}
%>
        </table>
        </form>
        
      </div>
      <div class="right">
        <h2>Need Help? </h2>
        <p>If you are confused about the registration process you can email any one of the following members of the Snazzy Team.</p>
        <p>Andrew Gratta: andrew.gratta@stonybrook.edu</p>
        <p>Sarah Jordan: sarahjor@buffalo.edu</p>
        <p>Kevin O'Flaherty: koflaherty@ymail.com</p>
        <p><img src="images/help.jpg" width="131" height="86" /></p>
      </div>
      <div class="clr"></div>
    </div>
  </div>
  <div class="footer">
    <div class="resize" style="background:#141414;">
      <p class="leftt">Created by: Andrew Gratta, Sarah Jordan, and Kevin O'Flaherty<br />
      <p class="rightt"><span class="leftt">Copyright. All Rights Reserved</span></p>
      <p class="rightt">Developed for CSE305 at Stony Brook University</p>
      <div class="clr"></div>
    </div>
  </div>
</div>
</body>
</html>